package com.ruoyi.lvlian.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.lvlian.domain.Pound;
import com.ruoyi.lvlian.service.IPoundService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 磅称管理Controller
 *
 * @author lvlian
 * @date 2025-04-24
 */
@Api(value = "磅称管理", tags = "磅称管理Controller")
@RestController
@RequestMapping("/pound")
public class PoundController extends BaseController {
    @Autowired
    private IPoundService poundService;

    /**
     * 查询磅称管理列表
     */
    @GetMapping("/list")
    public TableDataInfo list(Pound pound) {
        startPage();
        List<Pound> list = poundService.selectPoundList(pound);
        return getDataTable(list);
    }


    /**
     * 获取磅称管理详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return success(poundService.selectPoundById(id));
    }



    /**
     * 修改磅称管理
     */
    @Log(title = "磅称管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Pound pound) {
        return toAjax(poundService.updatePound(pound));
    }

    /**
     * 删除磅称管理
     */
    @Log(title = "磅称管理", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(poundService.deletePoundByIds(ids));
    }
}
